#include <stdio.h>

using namespace std;

int N, M;

int A[1000000 + 5];

int main() {
  freopen("in.txt", "r", stdin);

  while (scanf("%d%d", &N, &M) != EOF) {
    for (int i = 1; i <= N; ++i) {
      scanf("%d", &A[i]);
    }

    for (int i = 0; i < M; ++i) {
      char query[30];
      int a, b;
      scanf("%s%d%d", query, &a, &b);
      if (query[0] == 'Q') {
        int sum = 0;
        for (int j = a; j <= b; ++j) {
          sum += A[j];
        }
        printf("%d\n", sum);
      } else {
        A[a] += b;
      }
    }
  }
  return 0;
}